<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
  <head>
    <th:block th:replace="~{/_include/header}" />
    <title>[[${bundle.L('管理中心')}]]</title>
    <style>
      .rb-navbar-header .rb-toggle-left-sidebar,
      .rb-icons-nav {
        display: none !important;
      }
      @media (max-width: 767px) {
        .splash-footer,
        .navbar {
          display: none;
        }
        .rb-wrapper {
          padding-top: 0;
        }
      }
    </style>
  </head>
  <body>
    <div class="rb-wrapper rb-nosidebar-left rb-color-header">
      <th:block th:replace="~{/_include/nav-top}" />
      <div class="rb-content">
        <div class="main-content container-fluid">
          <div class="splash-container">
            <div class="card card-border-color card-border-color-primary">
              <div class="card-header">
                <h4>[[${bundle.L('需要验证你的管理员身份')}]]</h4>
              </div>
              <div class="card-body">
                <form>
                  <div class="form-group">
                    <input class="form-control" id="admin-passwd" type="password" th:placeholder="${bundle.L('登录密码')}" autocomplete="off" />
                  </div>
                  <div class="form-group login-submit">
                    <button class="btn btn-primary btn-xl J_verify-btn" type="submit">[[${bundle.L('确定')}]]</button>
                  </div>
                </form>
              </div>
            </div>
            <div class="splash-footer">
              <span><a href="javascript:history.back()">[[${bundle.L('返回')}]]</a></span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <th:block th:replace="~{/_include/footer}" />
    <script type="text/babel">
      $(document).ready(function () {
        const nexturl = $decode($urlp('nexturl') || '../admin/systems')
        const $btn = $('.J_verify-btn').on('click', () => {
          const passwd = $val('#admin-passwd')
          if (!passwd) {
            RbHighbar.create($L('请输入密码'))
            return false
          }

          $btn.button('loading')
          $.post('admin-verify?passwd=******', passwd, (res) => {
            if (res.error_code === 0) {
              location.replace(nexturl)
            } else {
              RbHighbar.create(res.error_msg)
              $btn.button('reset')
            }
          })
          return false
        })
      })
    </script>
  </body>
</html>
